package com.aiguigu.sort;

public class SelectSort {
    public static void main(String[] args) {
        int arr[] = {10,14,-1,5,6,55,47};
        for (int i = 0; i <arr.length-1 ; i++) {
            int minIndex = i;
            int min = arr[i];
            for (int j = i+1; j <arr.length ; j++) {
                if (arr[j]<min){
                    minIndex =j;
                    min = arr[minIndex];
                }
            }
            if (minIndex!=i){
                arr[minIndex] = arr[i];
                arr[i] = min;
            }
        }
        for (int i : arr) {
            System.out.print(i+" ");
        }
    }


}
